package com.sihai.ehr.service;

import java.util.List;

import com.sihai.core.Limit;
import com.sihai.core.LimitedList;
import com.sihai.core.Sorter;
import com.sihai.ehr.model.biz.ContractPerson;
import com.sihai.ehr.model.biz.ContractSign;
import com.sihai.ehr.model.biz.ContractSignAuditing;
import com.sihai.ehr.model.biz.ContractSignRt;
import com.sihai.ehr.model.biz.ContractSignRtt;
import com.sihai.ehr.model.biz.ContractSignZz;
import com.sihai.ehr.model.biz.ContractVersion;
import com.sihai.ehr.model.biz.ContractVersionAuditing;
import com.sihai.ehr.web.pojo.ContractSignPojo;
import com.sihai.ehr.web.pojo.ContractSignPojo2;
import com.sihai.ehr.web.pojo.ContractSignViewPojo;

/**
 * @author: wxn
 * @since: 12-6-22 下午12:43
 *
 * 合同管理Service
 */
public interface ContractService {
    ContractVersion getVersion(Long id);

    void saveVersion(ContractVersion version);

    void removeVersion(String ids);

    LimitedList<ContractVersion> findVersions(ContractVersion v, Limit limit, Sorter sorter);

    LimitedList<ContractVersion> findVersionsByOrganizationId(Long organizationId, Limit limit, Sorter sorter);

    LimitedList<ContractVersion> findVersionsByDutyId(Long dutyId, Limit limit, Sorter sorter);

    ContractPerson getPerson(Long id);
    
    /**
     * 根据职务编号获取合同版本关联信息
     * @param dutyId
     * @return
     */
    ContractPerson getContractPersonByDutyId(Long dutyId);

    void savePerson(ContractPerson person);

    LimitedList<ContractPerson> findPersonsByOrganizationId(Long organizationId, Limit limit, Sorter sorter);

    void removePersons(String ids);


    //合同签订审核列表
    LimitedList<ContractSignPojo2> findForContractSignAudit(Long organizationId, String type, Limit limit, Sorter sorter);
    //合同人员查看
    LimitedList<ContractSignViewPojo> findContractSignList(Long organizationId,Long dutyId,int month, Limit limit, Sorter sorter);

    ContractSign getContractSign(Long signId);
    ContractSignZz getContractSignZz(Long signZzId);
    ContractSignRt getContractSignRt(Long signRtId);
    ContractSignRtt getContractSignRtt(Long signRtId);
    
    void saveSignContract(Long reSignContractSignId, ContractSign contractSign);
    void saveSignContract(Long reSignContractSignZzId, ContractSignZz contractSignZz);
    void saveSignContract(Long reSignContractSignRtId, ContractSignRt contractSignRt);
    void saveSignContract(Long reSignContractSignRttId, ContractSignRtt contractSignRtt);
    
    void updateSignContract(ContractSign contractSign);
    void updateSignContract(ContractSignZz contractSignZz);
    void updateSignContract(ContractSignRt contractSignRt);
    void updateSignContract(ContractSignRtt contractSignRtt);

    /**
     * 更改合同签订状态
     * @param id               签订合同ID
     * @param state            状态ID
     */
    void updateContractSignState(Long id,Integer state);

    
    /**
     * 根据员工编号获取合同签订对象
     * @param employeeId
     * @return
     */
    ContractSign getContractSignByEmployeeId(Long employeeId, Long versionId);
    ContractSignZz getContractSignZzByEmployeeId(Long employeeId, Long versionId);
    ContractSignRt getContractSignRtByEmployeeId(Long employeeId, Long versionId);
    ContractSignRtt getContractSignRttByEmployeeId(Long employeeId, Long versionId);
    
    List<List<ContractVersionAuditing>> findContractVersionAuditing(Long id);

   //创建一个合同版本流程 
    void saveContractVersioniAuditingProcess(Long contractVersionId);

    /**
     * 合同签订审核
     * @param contractSignId
     * @return
     */
    List<List<ContractSignAuditing>> findContractSignAuditing(String type, Long contractSignId);

    /**
     * 根据组织编号及员工编号找到合同签约信息
     * @param organizationId
     * @param empolyeeId
     * @return
     */
    ContractSignPojo findForContractSignAuditByEmpolyeeId(Long organizationId,Long empolyeeId);
    ContractSignPojo2 findForContractSignAuditByEmpolyeeId2(Long organizationId,Long workId)throws Exception;
    //创建一个合同签订流程
    void saveContractSignAuditingProcess(String type, Long contractSignId);
}
